package com.example.gaojt.androiddemo.intentCover;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;

import java.net.URISyntaxException;

/**
 * Created by gaojt on 6/13/17.
 */

public class UriToIntent extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String uri = getIntent().getExtras().getString("uri");
        Log.d("aac", "UriToIntent onCreate: uri = " + uri);
        try {
            Intent intent = Intent.parseUri(uri, Intent.URI_INTENT_SCHEME);
            Log.d("aac", "onCreate: intent = " + intent);
            startActivity(intent);
        } catch (URISyntaxException e) {
            Log.w("aac", "onCreate: ", e);
        }
    }
}
